package com.example;

public class IncomeTaxCalculator {
    public float calculateTax(float income) {
        float tax = 0;
        float beyond = income - 5000; // 5000元免税额
        if (beyond <= 0) {
            tax = 0;
        } else if (beyond <= 3000) {
            tax = beyond * 0.03f;
        } else if (beyond <= 12000) {
            tax = beyond * 0.1f - 210;
        } else if (beyond <= 25000) {
            tax = beyond * 0.2f - 1410;
        } else if (beyond <= 35000) {
            tax = beyond * 0.25f - 2660;
        } else if (beyond <= 55000) {
            tax = beyond * 0.3f - 4410;
        } else if (beyond <= 80000) {
            tax = beyond * 0.35f - 7160;
        } else {
            tax = beyond * 0.45f - 15160;
        }
        return tax;
    }
}
